<script>
	import { getThemeMode } from '@/utils/themeManager.js';

	export default {
		onLaunch: function() {
			console.log('App Launch')
			
			// 设置默认主题
			const isDarkMode = getThemeMode();
			if (isDarkMode) {
				// 如果是暗黑模式，设置状态栏样式
				uni.setNavigationBarColor({
					frontColor: '#ffffff',
					backgroundColor: '#121212'
				});
			}
		},
		onShow: function() {
			console.log('App Show')
			
			// 获取当前页面路径并通知导航栏
			setTimeout(() => {
				const pages = getCurrentPages();
				if (pages.length > 0) {
					const currentPath = '/' + pages[pages.length - 1].route;
					uni.$emit('page-changed', currentPath);
				}
			}, 100);
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	/* 全局样式 */
	page {
		font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
			Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
		font-size: 14px;
		line-height: 1.5;
		color: #333;
		background-color: #f8f9fa;
	}

	* {
		box-sizing: border-box;
		margin: 0;
		padding: 0;
	}

	/* 主题颜色 */
	.theme-color {
		color: #20C0B8;
	}

	.theme-bg {
		background-color: #20C0B8;
	}

	button {
		cursor: pointer;
	}

	/* 清除uni-app默认样式 */
	button::after {
		border: none;
	}
</style>
